package com.sitech.timing.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.sitech.dao.BaseDao;
import com.sitech.timing.dao.TaskDao;
import com.sitech.timing.domain.GroupTaskInfo;
import com.sitech.timing.domain.GroupTaskInstance;
import com.sitech.timing.domain.TaskInfo;
import com.sitech.timing.domain.TaskInstance;
import com.sitech.timing.domain.TaskType;


public class TaskDaoImpl extends BaseDao implements TaskDao
{
	public List<GroupTaskInfo> getAllGroupTask()
	{
		return (List<GroupTaskInfo>)query("getAllGroupTask");
	}
	
	public List<TaskInfo> getAllTask()
	{
		return (List<TaskInfo>)query("getAllTask");
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#getAllTaskType()
	 */
	public List<TaskType> getAllTaskType()
	{
		return (List<TaskType>)query("getAllTaskType");
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#insertGroupTaskInstance(com.sitech.dmcs.core.domain.GroupTaskInstance)
	 */
	public void insertGroupTaskInstance(GroupTaskInstance groupTaskInstance)
	{
		insert("insertGroupTaskInstance",groupTaskInstance);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#insertTaskInstance(com.sitech.dmcs.core.domain.TaskInstance)
	 */
	public void insertTaskInstance(TaskInstance taskInstance)
	{
		insert("insertTaskInstance",taskInstance);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#deleteGroupTask(java.lang.String)
	 */
	public void deleteGroupTask(String groupTaskId)
	{
		delete("deleteGroupTask",groupTaskId);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#deleteTask(java.lang.String)
	 */
	public void deleteTask(String taskId)
	{
		delete("deleteTask",taskId);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#insertGroupTask(com.sitech.dmcs.core.domain.GroupTaskInfo)
	 */
	public void insertGroupTask(GroupTaskInfo groupTaskInfo)
	{
		insert("insertGroupTask",groupTaskInfo);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#insertTask(com.sitech.dmcs.core.domain.TaskInfo)
	 */
	public void insertTask(TaskInfo taskInfo)
	{
		insert("insertTask",taskInfo);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#deleteTaskType(java.lang.String)
	 */
	public void deleteTaskType(String taskTypeId)
	{
		delete("deleteTaskType", taskTypeId);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#insertTaskType(com.sitech.dmcs.core.domain.TaskType)
	 */
	public void insertTaskType(TaskType taskType)
	{
		insert("insertTaskType",taskType);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#getGroupTaskInstanceByStatus(java.lang.String)
	 */
	public List<GroupTaskInstance> getGroupTaskInstanceByStatus(String status)
	{
		return query("getGroupTaskInstanceByStatus", status);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#getTaskInstanceByStatus(java.lang.String)
	 */
	public List<TaskInstance> getTaskInstanceByStatus(String status)
	{
		return query("getTaskInstanceByStatus", status);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#updateGroupTaskInstance(com.sitech.dmcs.core.domain.GroupTaskInstance)
	 */
	public void updateGroupTaskInstance(GroupTaskInstance groupTaskInstance)
	{
		update("updateGroupTaskInstance", groupTaskInstance);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#updateTaskInstance(com.sitech.dmcs.core.domain.TaskInstance)
	 */
	public void updateTaskInstance(TaskInstance taskInstance)
	{
		update("updateTaskInstance", taskInstance);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#getTaskInstanceByGroup(java.lang.String, java.lang.String)
	 */
	public TaskInstance getTaskInstanceByGroup(String groupTaskInstanceId, String taskId)
	{
		Map<String, String> paramMap = new HashMap<String, String>();
		paramMap.put("groupTaskInstanceId", groupTaskInstanceId);
		paramMap.put("taskId", taskId);
		return (TaskInstance) querySingle("getTaskInstanceByGroup",paramMap);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#getGroupTaskInfo(java.lang.String)
	 */
	public GroupTaskInfo getGroupTaskInfo(String groupTaskId)
	{
		return (GroupTaskInfo) querySingle("getGroupTaskInfo", groupTaskId);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#getTaskInfo(java.lang.String)
	 */
	public TaskInfo getTaskInfo(String taskId)
	{
		return (TaskInfo) querySingle("getTaskInfo", taskId);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#getTaskTypeByGroupTaskId(java.lang.String)
	 */
	public List<TaskType> getTaskTypeByGroupTaskId(String groupTaskId)
	{
		return query("getTaskTypeByGroupTaskId", groupTaskId);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#getTaskByGroupTaskId(java.lang.String)
	 */
	public List<TaskInfo> getTaskByGroupTaskId(String groupTaskId)
	{
		return query("getTaskByGroupTaskId", groupTaskId);
	}

	/**
	 * (non-Javadoc)
	 * @see com.sitech.dmcs.core.dao.TaskDao#getGroupTaskBySuperGroupId(java.lang.String)
	 */
	public List<GroupTaskInfo> getGroupTaskBySuperGroupId(String superGroupTaskId)
	{
		return query("getGroupTaskBySuperGroupId", superGroupTaskId);
	}
}
